package com.zp.self.springboot.三种配置获取;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ValueConfigController {
    //通过 ${key} 方式从环境变量中获取值
    //通过 ${key} 方式全局配置文件中获取值
    //#{SpEL}
    @Value("张三")// 类似于xml 里面的<property name ="name" value="张三"></property>
    private String name;

    @GetMapping("/value/config")
    public Object getConfig() {
        return name;
    }
}